<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            .d1{
                width: 200px;
                height: 200px;
                border: 1px solid #999999;
            }
            #bgyellow:checked~.d1{
                background-color: yellow;
            }
             #bgblue:checked~.d1{
                background-color: blue;
            }
             #bgred:checked~.d1{
                background-color: red;
            }
        </style>
    </head>
    <body>
            <input type="radio" name="color" id="bgyellow" value="黄色">黄色
            <input type="radio" name="color" id="bgblue" value="绿色">绿色
            <input type="radio" name="color" id="bgred" value="红色">红色
            <div class="d1"></div>
    </body>
</html>